
<?php
require_once ('Zend/Controller/Action.php');

class Admin_ConfirmController extends Zend_Controller_Action {
   
   public function init() {
      // Using this to store a random hash key.
      
      $randomKey = md5(unique_id() . time());
      
      $session = Zend_Registry::get('session');
      $this->view->signature = $session->confirmKey = $randomKey;
      
   }

   public function deleterowAction() {
      $this->view->id = (int) $this->getRequest()->getParam('i');
      $this->view->controller = $this->getRequest()->getParam('c');
   }
   
   public function deletezoneAction() {
      require_once('Zones.php');
      
      $this->view->id = (int) $this->getRequest()->getParam('z');
      $this->view->controller = $this->getRequest()->getParam('c');
      
      // Grab a list of all NPCs within this zone -- so we know what will get removed.
      $model = new Zones();
      $resultSet = $model->find($this->view->id);
      $npcs = $resultSet->current()->findNpcs();
      
      $this->view->npcs = $npcs->toArray();
   }
   
   public function deleteeraAction() {
      require_once('Eras.php');
      
      $this->view->id = (int) $this->getRequest()->getParam('e');
      $this->view->controller = $this->getRequest()->getParam('c');
      
      $model = new Eras();
      $resultSet = $model->find($this->view->id);
      $zones = $resultSet->current()->findZones();

      $this->view->zones = $zones->toArray();
   }
}